﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using App.Core.Extensions;
using App.Data;

public partial class UserControls_Header : BaseUserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        StringBuilder sb = new StringBuilder();
        if (SessionCache.CurrentUser != null)
        {
            sb.AppendFormat("Welcome {0}", SessionCache.CurrentUser.LoginName);
        }
        ltrLogin.Text = sb.ToString();

        BindServiceProviderDropdown();
    }
    protected void BindServiceProviderDropdown()
    {
        BtcHousingEntities context  = new BtcHousingEntities();
        var businessTypes = from P in context.BusinessTypes where ConfigReader.ServiceProviderBusinessTypeIDs.Contains(P.ID) select P;
        StringBuilder sb = new StringBuilder();
        foreach (BusinessType bt in businessTypes)
        {
            sb.AppendFormat("<div><a href='/Pages/Public/CompanyList.aspx?{0}={1}'>{2}</a></div>"
                , AppConstants.QueryString.BUSINESS_TYPE_ID, bt.ID, bt.ShortName ); 
        }
        ltrServiceProviderSubMenue.Text = sb.ToString();
    }
}